home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK2.toast / Development Kits (Disc 2) / QuickDraw GX / Programming Stuff / Sample Code / Printing Samples / Extensions… / Additions ƒ / Additions.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-10  |  5.3 KB  |  143 lines  |  [TEXT/MPS ]

  1. /* ------------------------------------------------------------------------------
  2.  
  3.     FILENAME
  4.         Additions.h
  5.  
  6.     DESCRIPTION
  7.         This header file contains the declarations of the routines that create the graphical effects 
  8.         of the Additions printing extension.  These routines allow the user to augment pages of a
  9.         document with additive effects.
  10.         These effects include:
  11.         
  12.                     Adding a page border
  13.                     Serialize all printed copies
  14.                     Add cover page at beginning or end.
  15.                     
  16.         These options are configured through a Print dialog panel.
  17.  
  18.     COPYRIGHT
  19.         Copyright Apple Computer, Inc. 1991
  20.         All rights reserved. 
  21.     
  22.     INTERFACE ROUTINES
  23.         ComposeCoverPage
  24.         AddPageBorder
  25.         CreateNumberShape
  26.         SerializeCopies
  27.  
  28.     MODIFICATION HISTORY
  29.         05/15/91            ALA                Initial Implementation
  30.         08/26/94            dmh                Added "Length" macro.
  31.  
  32.  
  33. ------------------------------------------------------------------------------- */
  34.  
  35. #define Length(pStr) ((unsigned char) pStr[0])
  36.  
  37.  
  38. /*==================================== GLOBALS ====================================*/
  39.  
  40.  
  41. extern gxShape gSerialShape;
  42.  
  43.  
  44. /*==================================== CONSTANTS ====================================*/
  45.  
  46.  
  47. /* ===== Constants for accessing the 'addi' collection item. ===== */
  48.  
  49. #define    kAdditionsCollectionType    'addi'    /* Item type of the 'addi' Filter collection */
  50.  
  51.  
  52. /* ===== Constants for Identifying Cover Page First and Last ===== */
  53.  
  54. #define    kCoverPageFirst                0            /*    Add cover page at beginning of document */
  55. #define    kCoverPageLast                    1            /*    Add cover page at end of document */
  56.  
  57.  
  58. /*==================================== TYPES ====================================*/
  59.  
  60.  
  61. /* AdditionsCollection - structure defining the format of the 'addi' collection item.  It defines the */
  62. /*                                  type of additions to add to document pages.  The Addition's Print time dialog panel */
  63. /*                                 is used to set the values in this structure. This structure must match */
  64. /*                                 the 'xdtl'resource in the Additions.r file. */
  65.  
  66. typedef struct
  67. {
  68.     long            nextEndSerialNum;        //    ending serial number in the next batch to print
  69.     char            coverPage;                //    kCoverPageFirst or kCoverPageLast depending upon radio button settings
  70.     Boolean        addPageBorder;            //    true => add page border to document pages
  71.     Boolean        serializeCopies;        //    true => serialize all document pages
  72.     Boolean        addCoverPage;            //    true => add cover page to the document
  73. }    AdditionsCollection, *AdditionsCollectionPtr, **AdditionsCollectionHdl;
  74.  
  75.  
  76. /*======================== INTERFACE ROUTINES =======================*/
  77.  
  78.  
  79. /*========================= INTERFACE ROUTINES FOR ADDING A COVER PAGE =========================*/
  80.  
  81.  
  82. /* ===== ComposeCoverPage =====
  83.  
  84.     ComposeCoverPage creates a picture which represents the cover page of the printed
  85.     document.
  86. */
  87. OSErr ComposeCoverPage(                        //    (out)    Error code
  88.     gxShape                        *coverPage,        //    (out)    picture representing the cover page
  89.     gxFormat                        theFormat,        //    (in)    Cover page format reference
  90.     gxJobInfo                    *printerInfo);    //    (in)    Contains info. about the document being printed
  91.  
  92.  
  93. /*=================== INTERFACE ROUTINES FOR ADDING PAGE BORDER TO DOCUMENT PAGES ===================*/
  94.  
  95.  
  96. /* ===== AddPageBorder =====
  97.  
  98.     AddPageBorder adds a border around the entire page and and scales the page to make sure
  99.     all shapes fit within the border.  The page to border is specified by the "page" parameter.
  100.     
  101.     To add the page border, the routine performs the following steps:
  102.         1.    Make a copy of the original page shape (newPage variable).
  103.         2.    Scale the newPage shape by approx. 80%.
  104.         3.    Scale any embedded bitmaps in the newPage shape. (graphics didn't handle this before).
  105.         4.    Remove all shapes from the original page shape (page variable).
  106.         5.    Add the newPage shape to the page shape (must preserve the original page referenced passed to us).
  107.         6.    Add the shapes to the page shape which comprise the border.
  108.     
  109.     Note: the original page shape is duplicated because we must scale the contents of the shape,
  110.     but not the shapes which comprise the border.  Previously, it didn't work to scale the page down
  111.     and scale the border up so it's bigger.
  112. */
  113. OSErr AddPageBorder(                //    (out)    Error code
  114.     gxShape        page,                //    (in)    picture for the page being spooled; we'll add a border to it
  115.     gxFormat        pageFormat,        //    (in)    Page format record
  116.     Str32            docName);        //    (in)    Name of the document being printed
  117.  
  118.  
  119. /*======================== INTERFACE ROUTINES FOR SERIALIZING DOCUMENT PAGES =======================*/
  120.  
  121.  
  122. /* ===== CreateNumberShape =====
  123.  
  124.     CreateNumberShape creates a text shape which will be used to contain the serial number to
  125.     be added to the pages of the document.  This shape will exist for as long as the page
  126.     exists.  It's temporarily stored in the extension's refCon so we can retrieve it at render 
  127.     page time.
  128. */
  129. OSErr CreateNumberShape(void);    //    (out)    error code
  130.  
  131.  
  132. /* ===== SerializeCopies =====
  133.  
  134.     SerializeCopies adds the copy # to each page which is printed.
  135. */
  136. void SerializeCopies(                    //    (out)    Error code
  137.     gxShape            page,                    //    (in)    picture for the page being spooled
  138.     gxFormat            pageFormat,            //    (in)    Page format record
  139.     long                currCopyNum,        //    (in)    Current copy of the document being printed (relative to beginning of the job)
  140.     Boolean            *pageChanged,        //    (out)    True if a copy of a page has changed; otherwise ignored
  141.     long                 nextEndSerialNum,    //    (in)    last serial number in the batch being printed
  142.     long                 numCopies);            //    (in)    number of copies being printed
  143.